#include Servo panServo; // create servo object to control a servo Servo tiltServo; // create servo object to control a servo // Code for pan tilt void panTiltSetup(){ panServo.attach(PD5); tiltServo.attach(PD6); } void panTiltRaw(int panVal, int tiltVal){ panServo.writeMicroseconds(map(panVal, 0, 600, 1000, 2000)); // sets the servo position according to the scaled value tiltServo.writeMicroseconds(map(tiltVal, 0, 600, 1000, 2000)); // sets the servo position according to the scaled value } void setup() { panTiltSetup(); } void loop() { delay(1000); panTiltRaw(50, 0); delay(1000); panTiltRaw(250, 0); delay(1000); panTiltRaw(500, 100); delay(1000); panTiltRaw(0,0); delay(1000); panTiltRaw(0, 250); delay(1000); panTiltRaw(0, 600); delay(1000); panTiltRaw(0, 400); delay(1000); panTiltRaw(0, 0); delay(1000); panTiltRaw(500, 500); delay(1000); panTiltRaw(0,0); delay(1000); }